var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    }; Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("GlobalParams"),
    i = e("AudioManager"),
    r = e("PureHelper"),
    s = cc._decorator,
    l = s.ccclass,
    _ = s.property,
    c = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.attack_clip = null),
                (t.skill_one_clip = null),
                (t.skill_two_clip = null),
                (t.skill_three_clip = null),
                (t.die_clip = null),
                (t.is_attack_clip = !1),
                (t.is_skill_one_clip = !1),
                (t.is_skill_two_clip = !1),
                (t.is_skill_three_clip = !1),
                (t.is_die_clip = !1),
                (t.is_run = !1),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.playAttack = function () {
                var e = this,
                    t = this.myDisRound();
                if (!this.is_attack_clip && t && n.GlobalParams.gameSound.value) {
                    this.is_attack_clip = !0;
                    var o = cc.audioEngine.play(this.attack_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(o, function () {
                        e.is_attack_clip = !1;
                    });
                }
            }),
            (t.prototype.playSkillOne = function () {
                var e = this,
                    t = this.myDisRound();
                if (!this.is_skill_one_clip && t && n.GlobalParams.gameSound.value) {
                    this.is_skill_one_clip = !0;
                    var o = cc.audioEngine.play(this.skill_one_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(o, function () {
                        e.is_skill_one_clip = !1;
                    });
                }
            }),
            (t.prototype.playSkillTow = function () {
                var e = this,
                    t = this.myDisRound();
                if (!this.is_skill_two_clip && t && n.GlobalParams.gameSound.value) {
                    this.is_skill_two_clip = !0;
                    var o = cc.audioEngine.play(this.skill_two_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(o, function () {
                        e.is_skill_two_clip = !1;
                    });
                }
            }),
            (t.prototype.playSkillThree = function () {
                var e = this,
                    t = this.myDisRound();
                if (!this.is_skill_three_clip && t && n.GlobalParams.gameSound.value) {
                    this.is_skill_three_clip = !0;
                    var o = cc.audioEngine.play(this.skill_three_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(o, function () {
                        e.is_skill_three_clip = !1;
                    });
                }
            }),
            (t.prototype.playDie = function () {
                var e = this,
                    t = this.myDisRound();
                if (!this.is_die_clip && t && n.GlobalParams.gameSound.value) {
                    this.is_die_clip = !0;
                    var o = cc.audioEngine.play(this.die_clip, !1, 0.5);
                    cc.audioEngine.setFinishCallback(o, function () {
                        e.is_die_clip = !1;
                    });
                }
            }),
            (t.prototype.playRun = function () {
                var e = this,
                    t = this.myDisRound();
                if (!this.is_run && t && n.GlobalParams.gameSound.value) {
                    this.is_run = !0;
                    var o = i.default.getInstance().playFx("run");
                    cc.audioEngine.setFinishCallback(o, function () {
                        e.is_run = !1;
                    });
                }
            }),
            (t.prototype.plyerBeHit = function () {
                this.myDisRound() && i.default.getInstance().playFx("hit2");
            }),
            (t.prototype.myDisRound = function () {
                var e = !1,
                    t = this.node.parent.getChildByName("role_team_" + n.GlobalParams.MatchMyIndex);
                return (
                    cc.isValid(t, !0) &&
                    Math.abs(r.default.Distance(this.node.getPosition(), t.getPosition())) <
                    n.GlobalParams.showMaxDis &&
                    (e = !0),
                    e
                );
            }),
            oo([_(cc.AudioClip)], t.prototype, "attack_clip", void 0),
            oo([_(cc.AudioClip)], t.prototype, "skill_one_clip", void 0),
            oo([_(cc.AudioClip)], t.prototype, "skill_two_clip", void 0),
            oo([_(cc.AudioClip)], t.prototype, "skill_three_clip", void 0),
            oo([_(cc.AudioClip)], t.prototype, "die_clip", void 0),
            oo([l], t)
        );
    })(a.default);
o.default = c;
